1. Field of the Invention
The present invention relates to an image processing apparatus and image processing program and, more particularly, to an image processing apparatus and image processing program which cause a computer to process an image output from a 1-chip imaging system, 2-chip imaging system, or 3-chip pixel-shift imaging system and generate a color digital image having three color component values for each pixel.
2. Description of the Related Art
A 1-chip imaging sensing system used in a digital camera or the like uses a 1-chip imaging element mounted with color filters different for the respective pixels. An output image from a 1-chip imaging sensing element allows to derive only one type of color component value for each pixel. As a result, to generate a color digital image, color processing for compensating for color component values omitted in the respective pixels must be performed. This problem also arises in use of the 2-chip imaging system or 3-chip pixel-shift imaging system.
In this color processing, degradations such as blur or false colors occur in a final color image if simple techniches such as low pass filtering are used. For this reason, a variety of methods have been conventionally proposed. For example, in Jpn. Pat. Appln. KOKAI Publication No. 8-298669 which discloses a technique about edge detection, neighboring pixels are set in a cross-shaped manner around a pixel of interest, as shown in FIG. 15A, in an image sensing element of a 1CCD Bayer array having a color filter layout shown in FIG. 15A. Horizontal and vertical interpolation values Gh and Gv with respect to the pixel of interest are estimated byGh=(G4+G6)/2+(2*B5−B3−B7)/4Gv=(G2+G8)/2+(2*B5−B1−B9)/4  (1-1)Evaluation values dH and dV representing a degree of changes in the horizontal or vertical direction are calculated bydH=|G4−G6|+|B3−2*B5+B7|dV=|G2−G8|+|B1−2*B5+B9|  (1-2)An interpolation value in a direction having a smaller evaluation value and determined to be flatter is used. Note that |x| represents the absolute value of x, and * represents multiplication.
In Jpn. Pat. Appln. KIKAI Publication No. 10-164602 as another prior art, a difference |G2−G8| in the horizontal direction is calculated, and a value n is calculated as a function of the difference. Similarly, a difference |G4−G6| in the vertical direction is calculated, and a value m is calculated as a function of the difference. A final interpolation result Gx of the pixel of interest is calculated by weighting the horizontal and vertical pixel values byGx=(m*(G4+G6)+n*(G2+G8))/(2*(m+n))  (2-1)This equation is almost equivalent to calculations of vertical interpolation values byGh=(G2+G8)/2,Gv=(G4+G6)/2  (2-2)and the calculation of the weighted average of the vertical interpolation values byGx=(n*Gh+m*Gv)/(n+m)  (2-3)